package day3;

import org.junit.Test;

public class BubbleSort {
	@Test
	public void test1() {
		int num1 = 3;
		int num2 = 5;		
		int temp = 0;
		
		temp = num1;
		num1 = num2;
		num2 = temp;
		
		System.out.println("num1 before :" + num1);
		System.out.println("num2 before :" + num2);

		System.out.println("num1 after :" + num1);
		System.out.println("num1 after :" + num2);
		
	}
	
	//冒泡排序
	public static void main(String[] args) {
		int[] array = {40,17,21,1};
		//外层循环控制比较多少趟
		for (int i = 1; i <= array.length-1; i++) {
			//内层循环控制这一趟比较多少次
			for (int j = 0; j < array.length - i; j++) {
				//如果左边的值大于右边的值则交换位置
				if (array[j] > array[j+1]) {
					int temp = array[j];
					array[j] = array[j+1];
					array[j+1] = temp;
				}
				
				
			}
		}
		for (int i = 0; i < array.length; i++) {
			System.out.println(array[i]);
		}
		// Arrays.sort(array);
	}
	
	
	@Test
	public void test5() {
		int java = 2;
		
		long a = 0x123l;
		for(int i = 0 ; i < 10; i++ ) {
			
		}

		for(int i = 0 ; i < 10; i++ ) {
			
		}
	}
}
